feat(#416): support Android 16 (API 36) - #437
Conversation
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Robolectric 4.16 dropped emulation of SDK < 23, so the LSmsSender tests force Build.VERSION.SDK_INT instead of @config(sdk = 22). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Android 16 ignores orientation locks on large screens and the Play Store flags them. The predictive back opt-out keeps onBackPressed() working when targeting SDK 36. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
jonathanbataire
left a comment
There was a problem hiding this comment.
Thanks for starting this
let me have a look
| </intent-filter> | ||
| </activity> | ||
| <activity android:name="EmbeddedBrowserActivity" | ||
| android:screenOrientation="portrait" |
There was a problem hiding this comment.
does this mean it allows landscape for small devices
is this a hard requirement for v16
if android 16 ignores this on large devices then i think we can leave it so small device behavior is not altered
i think it should remain potrait for small devices the webapp may not be well optimized in landscape for small screens
There was a problem hiding this comment.
Yes, it allows landscape even on small devices.
It's not a hard requirement though, just something the Play Store flagged as a recommendation (#416 (comment)).
Tablets will still rotate regardless of the attribute.
I did some tesitng and looks like rotating doesn't recreate the activity or reload the webview.
My thinking was to follow the recommendation and keep behaviour consistent across devices, but I'm open to discussion (as noted in the description above). I am happy to restore the attribute if we'd rather not change phone behaviour in this PR.
jonathanbataire
left a comment
There was a problem hiding this comment.
@binokaryg this PR has a lot of great changes but i feel like most having nothing to do with targeting sdk36
isn't changing compileSdk and targetSdkVersion to 36 enough? am i missing sth
we could move these other improvements into new PRs/issues
FWIW ive tested it with just those changes and it seems to compile and run fine
During this work, the test suite failed when changing the SDK version.
AGP 8.10.1 + split ABI was Claude's suggestion sourced from Google's warning: Update: |
|
There's one more that is caused by the SDK bump:
So it works with 35 but breaks at 36. The flag |
AGP 8.8.2 builds fine with compileSdk 36 (warning only), so the upgrade and its ABI-splits workaround belong with #422 instead. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Keeps small-device behaviour unchanged, per review. Android 16 ignores these on large screens anyway. The predictive back opt-out stays: it fixes a regression caused by targeting SDK 36. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
I have removed the extras and kept only necessary bits. I've also updated the PR description above. |
|
i dont if we should indicate that builds uses java 21 now in the read me |
maybe its sth you can bebug with error logs nvm |
Fails fast with a clear error when JDK 21 is missing, instead of Robolectric failing later with UnsupportedOperationException. Covers test execution as well as compilation. Co-authored-by: Jonathan <jonathanbataire@gmail.com>
Closes #416.
Description
Targets Android 16 (API 36) ahead of Google Play's Aug 31, 2026 target API deadline.
Scope is deliberately limited to what the SDK bump requires — every change below has a reproducible failure behind it. Related-but-separable work has been moved out (see
Follow-upsbelow).Target SDK
compileSdkandtargetSdkVersion35 → 36.Back navigation (required by the bump)
Targeting SDK 36 enables predictive back by default, which bypasses our
onBackPressed()overrides. Addingandroid:enableOnBackInvokedCallback="false"restores current behaviour.This is a regression fix, not an improvement. A/B tested on an Android 16 emulator by opening the Custom URL form in settings and pressing back:
enableOnBackInvokedCallback="false"onBackPressed()never runsIt works today at 35 and breaks at 36. The failure is silent — the app compiles and runs normally — so it wouldn't show up in a smoke test. The same bypass affects
EmbeddedBrowserActivity(the webapp's back handling) andClosableAppActivity(finishAffinity).Migrating properly to
OnBackPressedDispatcheris worth doing, but it means movingEmbeddedBrowserActivityandClosableAppActivityoff plainActivityand convertingOpenSettingsDialogFragmentto an AndroidX fragment — too much for this PR.Tests (required by the bump)
A dependency chain, each link forced by the previous:
Package targetSdkVersion=36 > maxSdkVersion=35.mockito-inline5.2.0 →mockito-core5.23.0. The old ByteBuddy can't instrument alongside Robolectric 4.16 (Mockito cannot mock this class… Could not modify all classes, 130 failures).mockito-inlineis discontinued — inline mocks are the default since Mockito 5.UnsupportedOperationException at DefaultSdkProvider.java:170. Compile source/target compatibility stays at 17. Running unit tests locally now requires Java 21.LSmsSendertests forceBuild.VERSION.SDK_INTviaReflectionHelpersinstead of@Config(sdk = 22). The pre-M path is still shipped (minSdkVersion 21) and still tested.Testing
assembleUnbrandedDebugandbundleUnbrandedReleaseboth succeed.Follow-ups
Moved out of this PR after review:
compileSdk 36(it only warns "tested up to compileSdk 35"), so this isn't a prerequisite here — it belongs with bug: app bundling fails with current gradle version #422.android:screenOrientation="portrait"locks, which the Play Store flags as a recommendation. Not required: the restrictions are only ignored on displays withsw >= 600dp, so phones keep honouring them on Android 16 (and on Android 17 — the opt-out that disappears at API 37 isPROPERTY_COMPAT_ALLOW_RESTRICTED_RESIZABILITY, which we don't use). Whether phones should go adaptive is a product decision.SettingsDialogActivityhas noonSaveInstanceStateand noconfigChanges— so rotating while on the custom-URL form drops the user back to the server list. Pre-existing, but large-screen users will hit it.AI Disclosure
This PR was written primarily by Claude Code (Claude Fable 5), working interactively under my direction: it made the Gradle/manifest/test changes and ran the verification (unit tests, lint/static analysis, APK and bundle builds, the predictive-back A/B test, and manual testing on an Android 16 emulator and device). I reviewed the changes, chose the approach at each decision point, and did the final review of this description.
🤖 Generated with Claude Code